//
//  VisitorInfoModel.m
//  ppkc2016
//
//  Created by Laura on 2017/3/20.
//  Copyright © 2017年 拼凑的断音. All rights reserved.
//

#import "VisitorInfoModel.h"
#import "XXTool.h"

@implementation VisitorInfoModel

+(void)requestVisitorInfoListType:(NSString *)search
                              listCount:(NSInteger)count
                             completion:(void (^)(BOOL, NSMutableArray<VisitorInfoModel *> *))block{
    [DKHTTPRequest sendNewDataWithShortUrl:@"gz_list_search_2017_"
                                     Param:[XXTool formatStringWithLanguage:[NSString stringWithFormat:@"userid=%@&passwd=%@&nstart=%ld&ntotal=10&gz_name=%@",[UserInfo shareUserInfo].userID,[UserInfo shareUserInfo].userPassword,count,search]]
                                ImageArray:nil
                                   TimeOut:10
                                Completion:^BOOL(NSMutableDictionary *serverDic, DKHTTPResponseType bufferType) {
                                    if ([[serverDic objectForKey:@"code"] intValue]==200)
                                    {
                                        NSMutableArray *datalist = [NSMutableArray array];
                                        
                                            NSArray *tempArray = [serverDic objectForKey:@"gzlist"];
                                            for (NSDictionary* temp in tempArray)
                                            {
                                                [datalist addObject:[VisitorInfoModel modelWithDictionary:temp]];
                                            }
                                        
                                        block(YES,datalist);
                                    }
                                    else
                                    {
                                        
                                        block(NO,nil);
                                    }
                                    return YES;
                                } IsBuffering:YES
                         IsNeedReplaceWrap:NO
                           IsUseUpLoadHead:NO];

}

@end
